IF (NSS_CFLAGS)
ADD_LIBRARY(pathfinder-nss-1 SHARED libpathfinder.cc libpathfinder-nss.cc)
ADD_LIBRARY(pathfinder-nss-1-static STATIC libpathfinder.cc libpathfinder-nss.cc)
ENDIF (NSS_CFLAGS)

ADD_LIBRARY(pathfinder-openssl-1 SHARED libpathfinder.cc libpathfinder-openssl.cc)
ADD_LIBRARY(pathfinder-openssl-1-static STATIC libpathfinder.cc libpathfinder-openssl.cc)

IF (NSS_CFLAGS)
SET(LIBPATHFINDER_NSS_CFLAGS "${DBUS_CFLAGS} ${NSS_CFLAGS}")
TARGET_LINK_LIBRARIES(pathfinder-nss-1 ${DBUS_LIBRARIES})
SET_TARGET_PROPERTIES(pathfinder-nss-1 PROPERTIES COMPILE_FLAGS "${LIBPATHFINDER_NSS_CFLAGS}")
SET_TARGET_PROPERTIES(pathfinder-nss-1 PROPERTIES VERSION 1.0.0 SOVERSION 1 )
SET_TARGET_PROPERTIES(pathfinder-nss-1 PROPERTIES CLEAN_DIRECT_OUTPUT 1)

SET_TARGET_PROPERTIES(pathfinder-nss-1-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
SET_TARGET_PROPERTIES(pathfinder-nss-1-static PROPERTIES OUTPUT_NAME "pathfinder-nss-1")
SET_TARGET_PROPERTIES(pathfinder-nss-1-static PROPERTIES COMPILE_FLAGS "${DBUS_CFLAGS} ${NSS_CFLAGS} -fPIC")
ENDIF(NSS_CFLAGS)

SET(LIBPATHFINDER_OPENSSL_CFLAGS "${DBUS_CFLAGS} ${OPENSSL_CFLAGS}")
TARGET_LINK_LIBRARIES(pathfinder-openssl-1 ${DBUS_LIBRARIES})
SET_TARGET_PROPERTIES(pathfinder-openssl-1 PROPERTIES COMPILE_FLAGS "${LIBPATHFINDER_OPENSSL_CFLAGS}")
SET_TARGET_PROPERTIES(pathfinder-openssl-1 PROPERTIES VERSION 1.0.0 SOVERSION 1 )
SET_TARGET_PROPERTIES(pathfinder-openssl-1 PROPERTIES CLEAN_DIRECT_OUTPUT 1)
SET_TARGET_PROPERTIES(pathfinder-openssl-1 PROPERTIES LINK_FLAGS "${DBUS_LINKFLAGS} ${OPENSSL_LINKFLAGS} -fPIC")

SET_TARGET_PROPERTIES(pathfinder-openssl-1-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
SET_TARGET_PROPERTIES(pathfinder-openssl-1-static PROPERTIES OUTPUT_NAME "pathfinder-openssl-1")
SET_TARGET_PROPERTIES(pathfinder-openssl-1-static PROPERTIES COMPILE_FLAGS "${DBUS_CFLAGS} ${OPENSSL_CFLAGS} -fPIC")
IF (APPLE)
	SET_TARGET_PROPERTIES(pathfinder-openssl-1-static PROPERTIES LINK_FLAGS "${DBUS_LINKFLAGS} ${OPENSSL_LINKFLAGS} -fPIC")
ENDIF (APPLE)

IF(NOT DEFINED CMAKE_INSTALL_LIBDIR)
   SET(CMAKE_INSTALL_LIBDIR "lib")
ENDIF(NOT DEFINED CMAKE_INSTALL_LIBDIR)

IF (NSS_CFLAGS)
INSTALL(TARGETS pathfinder-nss-1 pathfinder-nss-1-static 
	LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" 
	ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
ENDIF(NSS_CFLAGS)

INSTALL(TARGETS pathfinder-openssl-1 pathfinder-openssl-1-static 
        LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" 
	ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")

INSTALL(FILES libpathfinder-nss.h libpathfinder-openssl.h libpathfinder.h
	      DESTINATION include/pathfinder-1)
